package com.example.jianbing;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;


/**
 * @ClassName : StreamDemo
 * @Description :
 * @Author : JB
 * @Date: 2020-08-08 23:02
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
class User{
    private Integer id;
    private String userName;
    private int age;
}

/***
 * 题目：
 *      请按照给出的数据，找出同时满足以下条件的用户，
 *      偶数ID且年龄大于24且用户转为大写且用户名字母倒排序
 *      只输出一个用户名字
 *
 */
public class StreamDemo {
    public static void main(String[] args) {
        User user1 = new User(11,"a",23);
        User user2 = new User(12,"b",24);
        User user3 = new User(13,"c",22);
        User user4 = new User(14,"d",28);
        User user5 = new User(16,"e",26);

        List<User> list = Arrays.asList(user1,user2,user3,user4,user5);
       // List<String> namelist = Arrays.asList(user1,user2,user3,user4,user5);


        List<User> list1 = new ArrayList<>();
        for (User user:list)
        {
            if(user.getId()%2==0 && user.getAge() > 24){
                list1.add(user);
            }
        }
        //Comparable comparable
    }
}
